﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Windows.Data;
using System.Globalization;
using System.Windows.Media;

namespace XBS.Converter
{
    public class ColorOpposite : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null) return null;
            
            SolidColorBrush color = (SolidColorBrush)value;
            byte a = color.Color.A;
            byte b = (byte)(255 - color.Color.B);
            byte g = (byte)(255 - color.Color.G);
            byte r = (byte)(255 - color.Color.R);

            return new SolidColorBrush(Color.FromArgb(a,r,g,b));
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
